<?php

 class BaseRecord { 
	
	const CREATED_ON = "created_on";
	const DELETED_ON = "deleted_on";
	
	private $arrData;
	
	//constructor that sets the value null for CREATED_ON and DELETED_ON
	
	function __construct(){
		
		$this->addKey(self::CREATED_ON);
		$this->addKey(self::DELETED_ON);
		
		//$this->arrData[self::CREATED_ON] = null;
		//$this->arrData[self::DELETED_ON] = null;
	}
	
	//sets a key into the arrData
	//keyName is the name of the key to be created
	protected function addKey($keyName){
		$this->arrData[$keyName] = null;
	}
	
	//sets data into the arrData
	//$objArrData is an array that constains data
	public function setData($objArrData){
		if(array_key_exists(self::CREATED_ON,$objArrData) && array_key_exists(self::DELETED_ON, $objArrData) ){
			$this->arrData[self::CREATED_ON] = $objArrData[self::CREATED_ON];
			$this->arrData[self::DELETED_ON] = $objArrData[self::DELETED_ON];
		}else{
			echo "BaseRecord : objArrData's structure is faulty";
		}
	}
	
	//returns the arrData array 
	public function getArrData(){
		return $this->arrData; 
	}
	
	//set a value into the arrData at $key
	//$key is a key in the array
	//$value is the value that is to bo set
	public function setValue($key,$value){
		if(array_key_exists($key,$this->arrData) ){
			$this->arrData[$key] = $value;
		}else{
			echo " wrong key ";
		}
	}
	
	//get the value at key from arrData 
	public function getValue($key){
		if(isset($this->arrData[$key])){
			return $this->arrData[$key];
		}else{
			echo "wrong key";
		}
	}
	
}

?>